/**
 * 工程名: HelloMyFriend
 * 文件名: MessageAdapter.java
 * 包名: com.stdroom.hellomyfriend.adapter
 * 日期: 2013-5-5下午4:23:33
 * Copyright (c) 2013, 北京联龙博通 All Rights Reserved.
 *
*/

package com.stdroom.hellomyfriend.adapter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.stdroom.hellomyfriend.R;
import com.stdroom.hellomyfriend.bean.ShortMessage;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * 类名: MessageAdapter <br/>
 * 功能: TODO 添加功能描述. <br/>
 * 日期: 2013-5-5 下午4:23:33 <br/>
 *
 * @author   "lx"
 * @version  	 
 */
public class MessageAdapter extends BaseAdapter{

	private Context context;
	private ArrayList<ShortMessage> list ;
	
	public MessageAdapter(Context context,ArrayList<ShortMessage> list){
		this.list = list;
		this.context = context;
	}
	
	@Override
	public int getCount() {
		
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
			LayoutInflater flater = LayoutInflater.from(context);
			convertView = flater.inflate(R.layout.message_list_item_layout, null);
		TextView tv_content = (TextView)convertView.findViewById(R.id.message_content);
		TextView tv_time = (TextView)convertView.findViewById(R.id.message_time);
		tv_content.setText(list.get(position).getData());
		tv_time.setText(list.get(position).getDate());
		return convertView;
	}

	
	
}

